//
//  LoginView.m
//  YTwallet
//
//  Created by ZhangLin on 2019/2/27.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "LoginView.h"
#import <Masonry.h>
@implementation LoginView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    self.backgroundColor = [UIColor whiteColor];
    
    self.logoImv = [[UIImageView alloc] init];
    self.logoImv.image = [UIImage imageNamed:@"logo"];
    [self addSubview:self.logoImv];
    [self.logoImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.mas_equalTo(30);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(80);
    }];
    
    self.phonoNumView = [[UIView alloc] init];
    [self addSubview:self.phonoNumView];
    [self.phonoNumView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.height.mas_equalTo(44);
        make.top.equalTo(self.logoImv.mas_bottom).offset(50);
    }];
    
    self.phonoLab = [[UILabel alloc] init];
    self.phonoLab.text = @"手机号";
    self.phonoLab.font = [UIFont systemFontOfSize:16.0f];
    self.phonoLab.textColor = [UIColor colorWithRed:102 / 255.0 green:102 / 255.0 blue:102 / 255.0 alpha:1];
    [self.phonoNumView addSubview:self.phonoLab];
    [self.phonoLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.phonoNumView);
        make.centerY.equalTo(self.phonoNumView);
        make.width.mas_equalTo(50);
    }];
    
    self.phonoNumTf = [[UITextField alloc] init];
    self.phonoNumTf.placeholder = @"您的手机号";
    self.phonoNumTf.font = [UIFont systemFontOfSize:16.0f];
    self.phonoNumTf.textAlignment = NSTextAlignmentLeft;
    self.phonoNumTf.keyboardType = UIKeyboardTypeNumberPad;
    self.phonoNumTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    [self.phonoNumView addSubview:self.phonoNumTf];
    [self.phonoNumTf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.phonoLab.mas_right).offset(30);
        make.centerY.equalTo(self.phonoNumView);
        make.right.equalTo(self.phonoNumView);
        make.height.equalTo(self.phonoNumView);
    }];
    
    self.phonoLineView = [[UIView alloc] init];
    self.phonoLineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 /255.0 blue:229 / 255.0 alpha:1];
    [self.phonoNumView addSubview:self.phonoLineView];
    [self.phonoLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.phonoNumView);
        make.right.equalTo(self.phonoNumView);
        make.bottom.equalTo(self.phonoNumView);
        make.height.mas_equalTo(1);
    }];
    
    
    
    
    self.passwordView = [[UIView alloc] init];
    [self addSubview:self.passwordView];
    [self.passwordView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.height.mas_equalTo(44);
        make.top.equalTo(self.phonoLineView.mas_bottom).offset(10);
    }];
    
    self.passwordLab = [[UILabel alloc] init];
    self.passwordLab.text = @"密码";
    self.passwordLab.font = [UIFont systemFontOfSize:16.0f];
    self.passwordLab.textColor = [UIColor colorWithRed:102 / 255.0 green:102 / 255.0 blue:102 / 255.0 alpha:1];
    [self.passwordView addSubview:self.passwordLab];
    [self.passwordLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.passwordView);
        make.centerY.equalTo(self.passwordView);
        make.width.mas_equalTo(50);
    }];
    
    self.passwordTF = [[UITextField alloc] init];
    self.passwordTF.placeholder = @"您的密码";
    self.passwordTF.font = [UIFont systemFontOfSize:16.0f];
    self.passwordTF.textAlignment = NSTextAlignmentLeft;
    self.passwordTF.returnKeyType = UIReturnKeyDone;
    self.passwordTF.secureTextEntry = YES;
    self.passwordTF.clearButtonMode = UITextFieldViewModeWhileEditing;
    [self.passwordView addSubview:self.passwordTF];
    [self.passwordTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.passwordLab.mas_right).offset(30);
        make.centerY.equalTo(self.passwordView);
        make.right.equalTo(self.passwordView);
        make.height.equalTo(self.passwordView);
    }];
    
    self.passwordLineView = [[UIView alloc] init];
    self.passwordLineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 /255.0 blue:229 / 255.0 alpha:1];
    [self.passwordView addSubview:self.passwordLineView];
    [self.passwordLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.passwordView);
        make.right.equalTo(self.passwordView);
        make.bottom.equalTo(self.passwordView);
        make.height.mas_equalTo(1);
    }];
    
    self.findPwdBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.findPwdBtn setTitle:@"找回密码" forState:(UIControlStateNormal)];
    [self.findPwdBtn setTitleColor:[UIColor colorWithRed:153.0f/255.0f green:153.0f/255.0f blue:153.0f/255.0f alpha:1.0f] forState:(UIControlStateNormal)];
    self.findPwdBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
    [self addSubview:self.findPwdBtn];
    [self.findPwdBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.passwordView.mas_bottom).offset(10);
        make.right.equalTo(self.passwordView);
    }];
    
    self.loginBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.loginBtn setTitle:@"登录" forState:(UIControlStateNormal)];
    self.loginBtn.userInteractionEnabled = NO;
    [self.loginBtn setTitleColor:[UIColor whiteColor]forState:(UIControlStateNormal)];
    self.loginBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
    self.loginBtn.backgroundColor = [UIColor colorWithRed:219/255.0 green:224/255.0 blue:255/255.0 alpha:1.0];
    self.loginBtn.layer.cornerRadius = 22;
    [self addSubview:self.loginBtn];
    [self.loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.findPwdBtn.mas_bottom).offset(20);
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.height.mas_equalTo(44);
        
    }];
    
    self.registerBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.registerBtn setTitle:@"新用户注册" forState:(UIControlStateNormal)];
    [self addSubview:self.registerBtn];
    [self.registerBtn setTitleColor:[UIColor colorWithRed:102.0f/255.0f green:102.0f/255.0f blue:102.0f/255.0f alpha:1.0f] forState:(UIControlStateNormal)];
    self.registerBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
    [self.registerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.mas_bottom).offset(-80);
        make.height.mas_equalTo(20);
    }];
    
    self.registerImv = [[UIImageView alloc] init];
    self.registerImv.image = [UIImage imageNamed:@"541"];
    [self addSubview:self.registerImv];
    [self.registerImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.registerBtn.mas_right);
        make.centerY.equalTo(self.registerBtn);
        make.height.mas_equalTo(16);
        make.width.mas_equalTo(16);
    }];
    
    
    self.radioBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.radioBtn.hidden = YES;
    [self.radioBtn setImage:[UIImage imageNamed:@"btn_radio_normal"] forState:(UIControlStateNormal)];
    [self.radioBtn setImage:[UIImage imageNamed:@"btn_radio_pressed"] forState:(UIControlStateSelected)];
    [self addSubview:self.radioBtn];
    [self.radioBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.passwordLineView);
        make.centerY.equalTo(self.findPwdBtn);
        make.width.mas_equalTo(20);
        make.height.mas_equalTo(20);
    }];
    
    self.remberPwdLab = [[UILabel alloc] init];
    self.remberPwdLab.hidden = YES;
    self.remberPwdLab.text = @"记住密码";
    self.remberPwdLab.font = [UIFont systemFontOfSize:14];
    self.remberPwdLab.textColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    [self addSubview:self.remberPwdLab];
    [self.remberPwdLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.radioBtn.mas_right);
        make.centerY.equalTo(self.radioBtn);
    }];
    
    
    
    
    
    
}

@end
